package top.sjydzq.www.controller.Mall;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import top.sjydzq.www.bean.Category;
import top.sjydzq.www.service.CategoryService;

import java.util.List;

@Controller
public class HeadController {
    @Autowired
    private CategoryService categoryService;

    @RequestMapping("/head")
    public String head(Model model) {
        List<Category> categories = categoryService.selectAll();

        model.addAttribute("categories", categories);

        return "Mall/head";
    }
}
